package com.atXiao.food.strategy;

/**
 * @author: lixiaoxiao
 * @date: 2024/1/10 16:42
 * @version: 1.0
 * @desc:
 */
public class StrategyExample {
    public static void main(String[] args) {
        // 传递的策略key值
        String selectStr = "111";
        // 选择key对应的策略模式（通过map获取策略模式来消除if-else）
        IPromotionStrategy promotionStrategy = PromotionStrategyFactory.getPromotionStrategy(selectStr);
        // 上下文对象中包装策略模式
        PromotionStrategyContext strategyContext = new PromotionStrategyContext(promotionStrategy);
        // 执行业务逻辑
        strategyContext.doExecute();


    }
}
